import request from './';

export function get(className, { objectId, params, data } = {}) {
  let path = '/classes/' + className;
  if (objectId) {
    path += '/' + objectId;
  }
  return request.get(path, { params, data });
}

export function post(className, { data } = {}) {
  const path = '/classes/' + className;
  return request.post(path, { data });
}

export function put(className, { objectId, data } = {}) {
  const path = '/classes/' + className + '/' + objectId;
  return request.put(path, { data });
}

export function del(className, { objectId } = {}) {
  const path = '/classes/' + className + '/' + objectId;
  return request.del(path);
}
